package com.ljh.controller;

import com.ljh.entity.Student;
import com.ljh.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author grung
 * @Date 2021/3/8 16:25
 * @Version 1.0
 */

@RestController
@RequestMapping("stu")
public class StudentController {

    @Autowired
    private StudentService studentService;

    @RequestMapping("/save")
    public String saveStudent(@RequestBody Student student){
        return studentService.saveStudent(student);
    }

    @RequestMapping("/delete/{id}")
    public String deleteStudent(@PathVariable Integer id){
        return studentService.deleteStudent(id);
    }

    @RequestMapping("/update")
    public String updateStudent(@RequestBody Student student){
        return studentService.updateStudent(student);
    }

    @RequestMapping("/select/{id}")
    public Student selectStudent(@PathVariable Integer id){
        return studentService.selectStudent(id);
    }
}
